/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


function showLoading(){
    $(document).click(function(e){
        $(this).unbind("click")
        var loc = location.href.substring(0,location.href.lastIndexOf('/'));
        loc = loc.substring(0,loc.lastIndexOf('/')+1);
        if($("#loadingAjax").length == 0){
            $("#eventi").append("<img id='loadingAjax' src='"+loc+"/wp-content/plugins/video-wizard/libs/Smarty/templates/img/loading.gif'/>")
            $("#loadingAjax").css({
                "position": "absolute",
                "top":  e.pageY-60+"px",
                "left": e.pageX-150+"px"
            });}
        });
    $(document).mousemove(function(e){
        $("#loadingAjax").css({
            "position": "absolute",
            "top":  e.pageY-60+"px",
            "left": e.pageX-150+"px"
        });
    })
}

function hideLoading(){
    $("#loadingAjax").remove();
    $(document).unbind("click")
    
}

function getArray(string){
    string = string.trim();
    var pattern = /\|beg\|+.+\|end\|/;
    string = string.match(pattern);
    string = string[0];
    
    string = string.replace("|beg|", "");
    string = string.replace("|end|", "");
    var splitted = string.split('|xxx|');
    var data = new Array();
    var tmp;
    for(var i = 0;i<splitted.length;i++){
        tmp = splitted[i].split('|x|');
        if(tmp){
            data[tmp[0]]=tmp[1];
        }
    }
    return data;
}

function getValue(string){
    var pattern = /\|beg\|+.+\|end\|/;
    string = string.match(pattern);
    string = string[0];
    string = string.replace("|beg|", "");
    string = string.replace("|end|", "");
    return string;
}

function disableClick(){
    $(document).click(function(e){
        $(this).unbind("click")
        var loc = location.href.substring(0,location.href.lastIndexOf('/'));
        loc = loc.substring(0,loc.lastIndexOf('/')+1);
        if($("#disable").length == 0){
            $("#eventi").append("<div id='disable'></div>")
            $("#disable").css({
                "position": "absolute",
                "top":  e.pageY-20+"px",
                "left": e.pageX-30+"px",
                "width": 200+"px",
                "height":200+"px",
                
                
            });}
        });
    $(document).mousemove(function(e){
        $("#disable").css({
            "position": "absolute",
            "top":  e.pageY-20+"px",
            "left": e.pageX-30+"px"
        });
    })
}

function enableClick(){
    $("#disable").remove();
    $(document).unbind("click")
}